package com.ruoyi.order.service.impl;

import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.VerOrderItemMapper;
import com.ruoyi.order.domain.VerOrderItem;
import com.ruoyi.order.service.IVerOrderItemService;

/**
 * 订单项Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-21
 */
@Service
public class VerOrderItemServiceImpl implements IVerOrderItemService
{
    @Autowired
    private VerOrderItemMapper verOrderItemMapper;
    private AtomicLong idGenerator = new AtomicLong();

    /**
     * 查询订单项
     *
     * @param id 订单项主键
     * @return 订单项
     */
    @Override
    public VerOrderItem selectVerOrderItemById(Long id)
    {
        return verOrderItemMapper.selectVerOrderItemById(id);
    }

    /**
     * 查询订单项列表
     *
     * @param verOrderItem 订单项
     * @return 订单项
     */
    @Override
    public List<VerOrderItem> selectVerOrderItemList(VerOrderItem verOrderItem)
    {
        return verOrderItemMapper.selectVerOrderItemList(verOrderItem);
    }

    /**
     * 新增订单项
     *
     * @param verOrderItem 订单项
     * @return 结果
     */
    @Override
    public int insertVerOrderItem(VerOrderItem verOrderItem)
    {
        verOrderItem.setId(idGenerator.getAndIncrement());
        return verOrderItemMapper.insertVerOrderItem(verOrderItem);
    }

    /**
     * 修改订单项
     *
     * @param verOrderItem 订单项
     * @return 结果
     */
    @Override
    public int updateVerOrderItem(VerOrderItem verOrderItem)
    {
        return verOrderItemMapper.updateVerOrderItem(verOrderItem);
    }

    /**
     * 批量删除订单项
     *
     * @param ids 需要删除的订单项主键
     * @return 结果
     */
    @Override
    public int deleteVerOrderItemByIds(Long[] ids)
    {
        return verOrderItemMapper.deleteVerOrderItemByIds(ids);
    }

    /**
     * 删除订单项信息
     *
     * @param id 订单项主键
     * @return 结果
     */
    @Override
    public int deleteVerOrderItemById(Long id)
    {
        return verOrderItemMapper.deleteVerOrderItemById(id);
    }
}
